package org.labuladong.动态规划算法.一维DP;

/**
 * @Auther: qingle
 * @Date: 2024/10/26-17:01
 * @Description:
 * @version: 1.0
 */
public class LC_300最长递增子序列 {

	public static int lengthOfLIS(int[] nums)
	{
		int[] dp = new int[nums.length];
		for (int i = 0; i < nums.length; i++) {
			dp[i] = 1;
		}

		for (int i = 1; i < nums.length; i++) {
			for (int j = 0; j < i; j++) {
				if (nums[i] > nums[j])
					dp[i] = Math.max(dp[i],dp[j]+1);
			}
		}

		int res = 0;
		for (int i = 0; i < dp.length; i++) {
			res = Math.max(res,dp[i]);
		}
		return res;
	}

	public static void main(String[] args) {

		int[] nums = {10,9,2,5,3,7,101,18};
		int res = lengthOfLIS(nums);
		System.out.println(res);
	}
}
